home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
H191.ZIP
/
CA29-3.EXE
/
HOST.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-07-14
|
7KB
|
455 lines
LEGE "Scripted HOST mode (1.2). Press ESC to exit."
S20="_PARM"(11:14)*","*"_PARM"(0:3)
S21="ATE0Q0V1X1S0=2 S7=30 S9=10^M"
S22="****"
S23="xxxx"
S24=""
SET PARI NONE
SET DATA 8
SET STOP 1
SET MASK ON
SET CR_I CR_L
SET ASCI UP_L LF
SET SOFT ON
IF ISSC "HOSTDAT" FCALL "HOSTDAT"
S0=S22
S3=S23
SUBD S29
DLDI S28
LOG MARK ON
CLOG "* Host script loaded"
ON ESCA GOSU End
SET INAF OFF
SET ALAR OFF
SET ATIM 1
SET PORT S20(0:3)
IF ISFILE "HOSTTEMP.STR" and ISFILE "HOSTTEMP.BAT"
SET RECH ON
DELE "HOSTTEMP.STR"
LOG OPEN "HOSTLOG"
CLOG "* Return from drop-to-DOS"
GOTO Main_Pro
ENDI
SET BAUD S20(5:8)
TRAN "_MESCAPE"
GOTO Restart
End:
HANG
CLOG "* HOST script terminated"
SET DLDI S28
CHDI S29
CLEA
MESS "HOST terminated... type Alt-X to exit COM-AND^M^J^M^J"
TRAN "_MINIT"
RESE
DELE "\HOSTTEMP.TXT"
IF ISSC "$$$SCHED" EXECUTE "$$$SCHED"
EXIT
Read_Com:
S9=""
N27=0
SET RMOD BINA
RCOM100:
SET TIME
WHIL NOT RECEIVE and NOT HITKEY
IF NOT CONNECTED GOTO RCOM500
TSIN N28,N29,N30
IF NOT ZERO N28 or N29 GT 3 GOTO RCOM400
ENDW
IF RECEIVE
RGET S27 1 180
IF FIND S27 "^M" GOTO RCOM300
GOTO RCOM200
ENDI
IF HITKEY
KEYG S27
IF FIND S27(0:1) "0d"
TRAN "!"
GOTO RCOM300
ENDI
IF FIND S27(0:1) "08"
ITOC 8 S27
S27(1:79)=""
ENDI
LENG S27 N28
IF N28 GT 1
SOUN 100,400
GOTO RCOM100
ENDI
IF NOT (FIND S27 "^H" and N27 EQ 0) TRANS S27
CURS N28 N29
ATSA N28 N29 (text) S27
IF FIND S27 "^H"
IF N27 GT 0 DEC N29
ELSE
INC N29
ENDI
LOCA N28 N29
ENDI
RCOM200:
IF FIND S27(0:0) "^H"
IF ZERO N27 GOTO RCOM100
DEC N27
IF N27 GT 0
S9=S9(0:N27-1)
ELSE
S9=""
ENDI
GOTO RCOM100
ENDI
S9=S9*S27
INC N27
IF N27 LT 80 GOTO RCOM100
RCOM300:
FIND S9 "NO CARRIER"
IF FOUND GOTO RCOM500
SET RMOD ASCI
SET FLAG(0) OFF
RETU
RCOM400:
TRAN "^M^J... autodisconnect due to timeout^M^J"
MESS "^M^J... autodisconnect due to timeout"
GOTO RComm_Ex
RCOM500:
MESS "^M^JCaller disconnected"
RComm_Ex:
SET RMOD ASCI
SET FLAG(0) ON
RETU
Restart:
CHDI S29
SET RECH OFF
SET RDIS OFF
CLEA
LOCA 0,0
IF NOT ISSC "$$$SCHED"
HANG
MESS "^M^JWaiting...!"
PAUS 3
ENDI
SET BAUD S20(5:8)
TRAN S21
WAIT_IT_:
RGET S9 80 180
IF NOT SUCCESS GOTO Wait_IT_Out
FIND S9 "NO CARRIER"
IF FOUND GOTO Exit
FIND S9 "CONNECT"
IF NOT FOUND GOTO WAIT_IT_OUT
GOSU AutoBaud
PAUS 2
RFLU
TRAN "^M^JThe Flying Scotsman greets you!!^M^J"
SET RECH ON
SET RDIS ON
LOG OPEN "HOSTLOG"
ID_Query:
MESS "^M^JID prompt: "
TRAN "^M^JEnter your ID: "
GOSU Read_Com
IF FLAG(0) GOTO Exit
SWIT S9
CASE "_NULL"
TRAN "You must be someone^M^J"
GOTO Exit
ENDC
ENDS
CLOG "* Host mode logon by "*S9
TRAN "^M^JEnter your password: "
LOG SUSP
SET RECH OFF
SET RDIS OFF
GOSU Read_Com
IF FLAG(0) GOTO Exit
LOG RESU
SET RECH ON
SET RDIS ON
SWIT S9
CASE S0
TRAN "^M^J"
ENDC
DEFA
TRAN "Sorry , but you're not authorized."
GOTO Exit
ENDC
ENDS
Main_Pro:
MESS "^M^JMain prompt: "
TRAN "^M^JC)hdir F)ilelist, P)athlist, U)pload, D)ownload, or E)xit: "
GOSU Read_Com
IF FLAG(0) GOTO Exit
SWIT S9
CASE "C"
GOTO CHDIR
ENDC
CASE "D"
GOTO DOWNLOAD
ENDC
CASE "E"
TRAN "Ok... bye^M^J"
GOTO EXIT
ENDC
CASE "F"
GOTO FILELIST
ENDC
CASE "P"
GOTO PATHLIST
ENDC
CASE "U"
GOTO UPLOAD
ENDC
CASE "X"
GOTO DOS
ENDC
CASE "Y"
GOTO DROPDOS
ENDC
CASE "OFF"
TRAN "Ok... bye^M^J"
GOTO EXIT
ENDC
DEFA
IF FIND S9 "CHDIR" GOTO CHRIR
IF FIND S9 "DOWN" GOTO DOWNLOAD
IF FIND S9 "FILE" GOTO FILELIST
IF FIND S9 "PATH" GOTO PATHLIST
IF FIND S9 "UP" GOTO UPLOAD
IF FIND S9 "DOS" GOTO DOS
TRAN "^M^JCommand not recognized... try again"
GOTO Main_Pro
ENDC
ENDS
TRAN "^M^JThank you veddy much.^M^J"
GOTO Main_Pro
EXIT:
CLOG "* Host mode exit"
LOG CLOS
MESS "^G"
IF ISSC "$$$SCHED" GOTO End
GOTO Restart
File_Que:
MESS "^M^JFname query: "
TRAN "^M^JEnter the file name: "
GOSU Read_Com
IF FLAG(0) RETURN
ASSI S8 S9
SWIT S8
CASE "_NULL"
SET FLAG(1) ON
RETU
ENDC
ENDS
SET FLAG(1) OFF
RETU
UPLOAD:
MESS "^M^JUpload from caller"
GOSU File_Que
IF FLAG(0) GOTO Exit
IF FLAG(1) GOTO Main_Prompt
IF ISFILE S8
TRAN "^M^JFile already exists"
GOTO UPLOAD
ENDI
MESS "!Method prompt: "
TRAN "^M^JW)xmodem, X)modem, Y)modem (X1k), Z)modem, or K)ermit: "
GOSU Read_Com
IF FLAG(0) GOTO Main_prompt
SWIT S9
CASE "W"
GETF WXMODEM S8
ENDC
CASE "X"
GETF XMODEM S8
ENDC
CASE "Y"
GETF YMODEM S8
ENDC
CASE "Z"
GETF ZMODEM
ENDC
CASE "K"
GETF KERMIT
ENDC
DEFA
TRAN "^M^JInvalid transfer selection"
GOTO Main_Pro
ENDC
ENDS
GOTO EOTransf
DOWNLOAD:
MESS "^M^JDownload to caller"
GOSU File_Que
IF FLAG(0) GOTO Exit
IF FLAG(1) GOTO Main_Prompt
IF NOT ISFILE S8
TRAN "^M^JFile doesn't exist"
GOTO DOWNLOAD
ENDI
MESS "^M^JMethod prompt "
TRAN "^MW)xmodem, X)modem, Y)modem (X1k), Z)modem, K)ermit, or A)scii: "
GOSU Read_Com
IF FLAG(0) GOTO Main_Prompt
SWIT S9
CASE "A"
SEND ASCII S8
ENDC
CASE "W"
SEND WXMODEM S8
ENDC
CASE "X"
SEND XMODEM S8
ENDC
CASE "Y"
SEND YMODEM S8
ENDC
CASE "Z"
SEND ZMODEM S8
ENDC
CASE "K"
SEND KERMIT S8
ENDC
DEFA
TRAN "^M^JInvalid transfer selection"
GOTO Main_Pro
ENDC
ENDS
GOTO EOTransf
EOTRANSF:
IF NOT SUCCESS
MESS "^M^JTransfer failed"
ELSE
MESS "^M^JTransfer OK"
ENDI
GOTO Main_Pro
FILELIST:
MESS "^M^JFilelist command: "
TRAN "^M^J Working..."
DOS "DIR >HOSTTEMP.TXT"
TRAN "^M^J"
SEND ASCII "HOSTTEMP.TXT"
TRAN "^M^J"
DOS "DEL HOSTTEMP.TXT"
GOTO Main_Pro
CHDIR:
MESS "^M^JCHDIR Command: "
TRAN "^M^JEnter the drive:subdirectory: "
GOSU Read_Com
IF FLAG(0) GOTO Main_Prompt
CHDI S9
GOTO Main_Pro
PATHLIST:
MESS "^M^JPathlist command: "
TRAN "^M^J Working..."
DOS "Treed >HOSTTEMP.TXT"
TRAN "^M^J"
SEND ASCII "HOSTTEMP.TXT"
TRAN "^M^J"
DOS "DEL HOSTTEMP.TXT"
GOTO Main_Pro
DOS:
GOSU DOSPSW
IF FAILED GOTO Main_Prompt
MESS "^M^JDOS Command: "
TRAN "^M^JEnter the command: "
GOSU Read_Com
IF FLAG(0) GOTO Main_Prompt
TRAN "^M^J Working..."
CONC S9 ">HOSTTEMP.TXT"
DOS S9
TRAN "^M^J"
SEND ASCII "HOSTTEMP.TXT"
TRAN "^M^J"
DOS "DEL HOSTTEMP.TXT"
GOTO Main_Pro
DOSPSW:
MESS "^M^JRequesting DOS password"
LOG SUSP
SET RECH OFF
SET RDIS OFF
TRAN "^M^JEnter the DOS password: "
GOSU Read_Com
IF FLAG(0) GOTO DOSPERR
LOG RESU
SET RECH ON
SET RDIS ON
SWIT S9
CASE S3
TRAN "^M^J"
ENDC
DEFA
TRAN "Sorry , but you're not authorized."
GOTO DOSPERR
ENDC
ENDS
LOG RESU
SET SUCC ON
RETU
DOSPERR:
LOG RESU
SET SUCC OFF
RETU
DROPDOS:
IF NULL S24
TRAN "^M^JCommand not recognized... try again"
GOTO Main_Pro
ENDI
GOSU DOSPSW
IF FAILED GOTO Main_Prompt
FOPENO "HOSTTEMP.BAT" TEXT
IF NOT SUCCESS
TRAN "File error - cannot drop to DOS^M^J"
GOTO Main_Pro
ENDI
WRIT "ECHO OFF!"
S0=S24
PRES S0
WRIT S0
WRIT "!"
WRIT S29(0:1)*"!"
IF NOT NULL S29(2:79) WRITE "CD "*S29(2:79)&"!"
WRIT "COM-AND /q/p/fHOST!"
WRIT "^Z"
FCLOSEO
STOR STRING "HOSTTEMP.STR"
CLOG "* Drop-to-DOS"
SET TTHR OFF
STAC CLEAR
STAC "HOSTTEMP.BAT!"
BYE
AutoBaud:
IF FIND "_DDOVER" "ON" RETURN
IF FIND S9 "1200"
SET BAUD 1200
RETU
ENDI
IF FIND S9 "2400"
SET BAUD 2400
RETU
ENDI
IF FIND S9 "4800"
SET BAUD 4800
RETU
ENDI
IF FIND S9 "9600"
SET BAUD 9600
RETU
ENDI
IF FIND S9 "14400" or FIND S9 "14.4"
SET BAUD 14k
RETU
ENDI
IF FIND S9 "19200" or FIND S9 "19.2"
SET BAUD 19k
RETU
ENDI
IF FIND S9 "38400" or FIND S9 "38.4"
SET BAUD 38k
RETU
ENDI
IF FIND S9 "57600" or FIND S9 "57.6"
SET BAUD 57k
RETU
ENDI
SET BAUD 300
RETU